package com.lipy.tools.entitymapping;

import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.ArrayList;
import java.util.Collections;

/**
 * @Description TODO
 * @Date 2020/11/25 17:03
 * @Author by lipye
 */
public class Test {

    public static void main(String[] args) {

        StudentToVO mapper = Mappers.getMapper(StudentToVO.class);
        Student student = new Student("lili","ABC123",1);
        StudentVO studentVO = mapper.toStudentVO2(student);
        System.out.println("studentVO = " + studentVO);

        Grade grade = new Grade();
        grade.setName("grade");
        grade.setStudents(Collections.singletonList(student));
        GradeVO convert = mapper.convert(grade);
        System.out.println(convert.getStudents().get(0));


        Person person = Person.builder().name("pp").create();
        PersonVo personVo = mapper.convertPerson(person);
        System.out.println("personVo = " + personVo);

    }
}
